Introduction | Windows Helpline Q&A Directory 

Autorun programs on shutdown

Can you tell me if there is a way to run certain applications automatically when I close Windows?

What better time to scan defrag, and back up your hard drive than when you're shutting down at the end of the day? Unfortunately, Windows doesn't provide a way to do this, so you'll have to go with third-party software.

We recommend Kill Win, a little program by BK Soft that lets you set up an icon to run one or more programs, then shut down Windows. There are two current versions of the program - one free and one shareware - and both are available at www.borgking.de/bk-soft. (Both also require the Visual Basic 6.0 runtime. For further information on this, go to http://support.microsoft.com/support/vbasic/runtime.asp.

You can use either version to automatically run other programs before closing Windows, but to do so with the free Kill Win 2.1.6 you'll have to create a batch file. Select Start, Programs, Accessories, Notepad. Assuming you've installed Kill Win in the C:\KillWin folder, enter the text c:\killwin\killwin /w. Press Enter.

On the next line, type start /w, followed by the command to run a program. For instance, if you want to scan your hard drive, type start /w scandskw c: /n. The 'start /w' will make the batch file wait before it goes on to the next command. Press Enter to go to the next line. If you want to run more than one program, type each command on its own line, prefaced with start /w. Finally, type c:\killwin\killwin /s on the last line to exit Windows.

Save the file with the extension .bat, as in Close Windows.bat, and place it somewhere convenient, such as on your Start menu. When you want to shut down Windows, select Start, Close Windows rather than the usual Start, Shut down. When you run this batch file, you'll get an error message telling you that it can't close the DOS window while it's running the batch file. Don't worry about it.

The $15 Kill Win Pro makes running other programs before shutdown easier. Once you have installed and launched Kill Win Pro, select the Settings tab. On the Various things tab, check 'Execute another program before the execution of an action'. Directly below, select 'Until this app has closed, then execution'.

For 'Location of the app', enter the command to launch the application you want to run before shutting down Windows. For the default action, select Shut down Windows. Finally, click ok.

Now, to run your program and exit Windows, launch Kill Win Pro from the Start menu, then double-click its system tray icon. Or you can simply double-click the Kill Win Pro icon on your desktop. This shortcut, unlike the one in the Start menu, automatically runs Kill Win Pro's default action.
 © 2002 PC Advisor